import { createRequest } from '/@/api/service';
const module = 'ib/equipment/v1/AssetChangeAllocationApi/';

/**
 * @function 设备调拨——列表查询
 * @param data
 * @param header
 * @returns
 */
function QUERY_CHANGE_ALLOCATION_LIST(
  data: AssetChangeAllocationApi.QueryChangeAllocationListReq,
  header: object = {},
): Promise<AssetChangeAllocationApi.QueryChangeAllocationListResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}queryChangeAllocationList`,
    data,
    header,
    'POST',
  );
}

/**
 * @function 调拨归还——新增调拨
 * @param data
 * @param header
 * @returns
 */
function INSERT_CHANGE_ALLOCATION(
  data: AssetChangeAllocationApi.InsertChangeAllocationReq,
  header: object = {},
): Promise<AssetChangeAllocationApi.InsertChangeAllocationResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}insertChangeAllocation`,
    data,
    header,
    'POST',
  );
}

/**
 * @function 调拨归还—查看详情
 * @param data
 * @param header
 * @returns
 */
function QUERY_CHANGE_ALLOCATION_DETAIL(
  data: AssetChangeAllocationApi.QueryChangeAllocationDetailReq,
  header: object = {},
): Promise<AssetChangeAllocationApi.QueryChangeAllocationDetailResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}queryChangeAllocationDetail`,
    data,
    header,
    'POST',
  );
}

/**
 * @function 调拨归还—确认签收
 * @param data
 * @param header
 * @returns
 */
function SIGN_CHANGE_ALLOCATION(
  data: AssetChangeAllocationApi.SignChangeAllocationReq,
  header: object = {},
): Promise<AssetChangeAllocationApi.SignChangeAllocationResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}signChangeAllocation`,
    data,
    header,
    'POST',
  );
}

/**
 * @function 设备调拨——调拨审批
 * @param data
 * @param header
 * @returns
 */
function APPROVAL_CHANGE_ALLOCATION(
  data: AssetChangeAllocationApi.ApprovalChangeAllocationReq,
  header: object = {},
): Promise<AssetChangeAllocationApi.ApprovalChangeAllocationResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}approvalChangeAllocation`,
    data,
    header,
    'POST',
  );
}

export {
  QUERY_CHANGE_ALLOCATION_LIST,
  INSERT_CHANGE_ALLOCATION,
  QUERY_CHANGE_ALLOCATION_DETAIL,
  SIGN_CHANGE_ALLOCATION,
  APPROVAL_CHANGE_ALLOCATION,
};
